﻿using BussinessObject.ObjectOne;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectHK3
{
    public partial class Branches : System.Web.UI.Page
    {
        B_Branches ex = new B_Branches();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadAllData();
                load();
            }
        }
        
        protected void _ddlBranch_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        public void LoadAllData()
        {
            _ddlBranch.DataSource = ex.LoadDropbox();
            _ddlBranch.DataTextField = "CITY_NAME";
            _ddlBranch.DataValueField = "CITY_ID";
            _ddlBranch.DataBind();

        }
        public void load()
        {
            int cityId = Convert.ToInt32(_ddlBranch.SelectedValue.ToString());

            _dlstBranch.DataSource = ex.LoadContent(cityId);
            _dlstBranch.DataBind();
        }
        protected void _btnSearchBranch_Click(object sender, EventArgs e)
        {
           
        }

        protected void LinkButton1_Command(object sender, CommandEventArgs e)
        {
            Session["_branchId"] = e.CommandArgument.ToString();
            Response.Redirect("BranchDetail.aspx");
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {

        }

        protected void _btnSearchBranch_Click1(object sender, EventArgs e)
        {
            load();
        }
    }
}